using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using SalesPages.DomainModel;

namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class PartnerLinkMap : EntityTypeConfiguration<PartnerLink>
    {
        public PartnerLinkMap()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            this.Property(t => t.country)
                .IsFixedLength()
                .HasMaxLength(2);

            this.Property(t => t.imageurl)
                .HasMaxLength(100);

            this.Property(t => t.linkurl)
                .HasMaxLength(100);

            this.Property(t => t.alttext)
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("PartnerLinks");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.country).HasColumnName("country");
            this.Property(t => t.imageurl).HasColumnName("imageurl");
            this.Property(t => t.linkurl).HasColumnName("linkurl");
            this.Property(t => t.altblurb).HasColumnName("altblurb");
            this.Property(t => t.alttext).HasColumnName("alttext");
        }
    }
}
